/**
 * 功能权限管理
 */
import axios from '@/libs/http'
import qs from 'qs'

/**
 * 分页查询功能权限
 */
export const queryPermission = data => {
  return axios({
    method: 'post',
    url: '/auth/permissions',
    data: data
  })
}

/**
 * 检查权限是否已存在
 */
export const checkName = data => {
  return axios({
    method: 'post',
    url: '/auth/permission/checkName',
    data: data
  })
}

/**
 * 检查接口路径是否已存在
 */
export const checkPath = data => {
  return axios({
    method: 'post',
    url: '/auth/permission/checkPath',
    data: data
  })
}

/**
 * 添加权限
 */
export const addPermission = data => {
  return axios({
    method: 'post',
    url: '/auth/permission?action=add',
    data: data
  })
}

/**
 * 更新权限信息
 */
export const updatePermission = data => {
  return axios({
    method: 'post',
    url: '/auth/permission?action=upd',
    data: data
  })
}

/**
 * 批量删除权限
 */
export const deletePermission = ids => {
  return axios({
    method: 'post',
    url: '/auth/permission?action=del',
    data: ids
  })
}

/**
 * 获取固定格式所有权限
 */
export const getAllPermission = () => {
  return axios({
    method: 'get',
    url: '/auth/permissions'
  })
}
